home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / pctj8409.arc / LOWER.ASM < prev    next >
Assembly Source File  |  1986-09-14  |  768b  |  35 lines

  1. ; ROUTINE TO CONVERT STRING TO LOWER CASE
  2. ;
  3. lowercase    proc    far
  4. ;
  5.     push    bx        ; save registers
  6.     push    cx
  7.     push    ax
  8. ;
  9. ; get the length
  10.     mov    cx,[bx]        ; first two bytes contain the length
  11.     inc    bx        ; point to beginning of text
  12.     inc    bx
  13. ;
  14. ; loop through the bytes of the string
  15. lowercase1:
  16.     mov    al,[bx]        ; get the character
  17.     cmp    al,'A'        ; below the upper case characters?
  18.     jb    lowercase2    ; skip if so
  19.     cmp    al,'Z'        ; above the upper case characters?
  20.     ja    lowercase2    ; skip if so
  21. ;
  22.     or    al,20h        ; OR bit 5 into the byte
  23. ;
  24. lowercase2:
  25.     mov    [bx],al        ; store the character
  26.     inc    bx        ; point to next character
  27.     loop    lowercase1
  28. ;
  29.     pop    ax        ; restore registers
  30.     pop    cx
  31.     pop    bx
  32.     ret
  33. ;
  34. lowercase    endp
  35.